using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Lidgren.Network;

namespace MvdDonk.Bomberman.Lib
{
    public static class MessageFinder
    {
        public static IMessage GetMessageFromClient(NetIncomingMessage msg)
        {
            var action = (char)msg.ReadBytes(2)[0];
            switch (action)
            {
                case 'M': return MovementMessage.ReceiveFromClient(msg);
                case 'P': return PositionMessage.ReceiveFromClient(msg);
            }
            return null;
        }

        public static IMessage GetMessageFromServer(NetIncomingMessage msg)
        {
            var action = (char)msg.ReadBytes(2)[0];
            switch (action)
            {
                case 'M': return MovementMessage.ReceiveFromServer(msg);
                case 'P': return PositionMessage.ReceiveFromServer(msg);
            }
            return null;
        }
    }
}
